<template>
  <div class="count-box">
    <div style="height:28px;" class="mui-numbox" data-numbox-min="1">
      <!-- "-"按钮，点击可减小当前数值 -->
      <button class="mui-btn mui-numbox-btn-minus" type="button">-</button>
      <input @change="test" class="mui-numbox-input" type="number" ref="count" value="1">
      <!-- "+"按钮，点击可增大当前数值 -->
      <button class="mui-btn mui-numbox-btn-plus" type="button">+</button>
    </div>
  </div>
</template>
<script>
import mui from "hongde-demo/js/mui.min.js";
export default {
  data() {
    return {};
  },
  props: ["num"],
  mounted() {
    mui(".mui-numbox").numbox();
  },
  methods: {
    test() {
      this.$emit("give", this.$refs.count.value);
    }
  },
  watch: {
    num: function(newVal) {
      mui(".mui-numbox")
        .numbox()
        .setOption("max", newVal);
    }
  }
};
</script>
<style lang="css" scoped>
</style>